package com.wc.算法基础课.D第四讲数学知识.高斯消元.高斯消元解异或线性方程组;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/23 20:19
 * @description https://www.acwing.com/problem/content/886/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 110;
    static int[][] a = new int[N][N];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n + 1; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        int res = gauss();
        if (res == 0) {
            for (int i = 0; i < n; i++) {
                out.println(a[i][n]);
            }
        } else if (res == 1) {
            out.println("Multiple sets of solutions");
        } else {
            out.println("No solution");
        }

        out.flush();
    }

    static int gauss() {
        int r, c;
        // 变列
        for (r = c = 0; c < n; c++) {
            int t = r;
            for (int i = r; i < n; i++) {
                if (a[i][c] == 1) {
                    t = i;
                    break;
                }
            }
            // 说明全是0
            if (a[t][c] == 0) continue;
            // 交换
            swap(a, t, r);
            // 将其他行的该列置为0
            for (int i = r + 1; i < n; i++) {
                if (a[i][c] != 0) {
                    for (int j = c; j <= n; j++) {
                        a[i][j] ^= a[r][j];
                    }
                }
            }
//            show();
            r++;
        }
        // 判断
        if (r < n) {
            for (int i = r; i < n; i++) {
                if (a[i][n] > 0) return 2;
            }
            return 1;
        }

        // 将左边变为单位矩阵
        for (int i = n - 1; i >= 0; i--) {
            for (int j = i + 1; j < n; j++) {
                if (a[i][j] > 0) {
                    a[i][n] ^= a[j][n];
                }
            }
//            show();
        }

        return 0;
    }

    static void swap(int[][] a, int i, int j) {
        int[] tmp = a[i];
        a[i] = a[j];
        a[j] = tmp;
    }

    static void show() {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n + 1; j++) {
                System.out.print(a[i][j] + " ");
            }
            System.out.println();
        }
        System.out.println();
    }
}


class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
